package com.blog.controller;

import com.blog.pojo.Article;
import com.blog.pojo.Comment;
import com.blog.service.ArticleService;
import com.blog.service.CommentService;
import com.blog.service.impl.ArticleServiceImpl;
import com.blog.service.impl.CommentServiceImpl;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.ws.Response;
import java.io.IOException;
import java.util.List;

@WebServlet("/StarCommentServlet.do")
public class StarCommentServlet extends HttpServlet {
    CommentService commentService=new CommentServiceImpl();



    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        req.setCharacterEncoding("UTF-8");
        resp.setContentType("text/html;charset=utf-8");
        String articleId=req.getParameter("articleId");
        String commentId= req.getParameter("commentId");
        String url="/Blog/ArticleDetailServlet.do?id="+articleId;
        int count=commentService.starById(commentId);
        resp.sendRedirect(url);
    }
}
